package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.PowerB22a;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class PowerB22aConverter implements AttributeConverter<PowerB22a, String> {
    @Override
    public String convertToDatabaseColumn(PowerB22a powerB22a) {
        return JSONUtil.toJsonStr(powerB22a);
    }

    @Override
    public PowerB22a convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, PowerB22a.class);
    }
}
